[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
getdefaultpalette() Get the Current Palette
#include <graphics.h>
struct palettetype *far getdefaultpalette(void);
This function fills a structure of type palettetype as
initialized by a previous call to initgraph():
struct palettetype
{
unsigned char size;
signed char colors[MAXCOLORS+1];
};
Returns: A pointer to a structure of type palettetype.
-------------------------------- Example ---------------------------------
The following statements draw three rectangles, then get the
default palette and store it in a structure named my_pal.
#include <graphics.h>
#include <conio.h>
int gdriver = DETECT;
int gmode;
struct palettetype far *my_pal = (void *) 0;
main()
{
int whcolor;
initgraph(&gdriver,&gmode,"");
whcolor = getcolor();
rectangle(100,100,200,150);
setcolor(4);
rectangle(300,100,400,150);
setcolor(whcolor);
rectangle(100,250,200,300);
my_pal = getdefaultpalette();
getch();
closegraph();
}
See Also:
getpalette()
getcolor()
initgraph()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson